<template>
  <div>
      <!-- 绑定键盘按下事件，enter-回车 -->
      <input type="text" @keydown.enter="enterFn">
      <br>
        <!-- 绑定键盘按下事件，esc-回车 -->
      <input type="text" @keydown.esc="escFn">
  </div>
</template>

<script>
export default {
    methods: {
        enterFn(){
            console.log('用户按下了回车')
        },
        escFn(){
            console.log('用户按下了esc')
        }
    }
}
</script>

<style>

</style>